package main;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

import constants.Colors;

public class MainMenu extends JFrame  {

	private static final long serialVersionUID = 6170362161996929491L;

	JPanel main, border;
	public JButton[][] map;
	public static JTextArea content;
	
	public MainMenu() {
		super("Adventure Land -- Main Map");
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setResizable(false);
		map = new JButton[10][10];
		this.setSize(800, 800);
		setupComponents();
		setupButtons();
		addComponents();
		this.add(border);
		this.setVisible(true);
	}
	
	private void setupButtons() {
		for (int ii = 0; ii < 10; ii++) {
			for (int i = 0; i < 10; i++) {
				map[ii][i] = new JButton();
				map[ii][i].setBackground(Colors.BACKGROUND_COLOR);
				map[ii][i].setBorderPainted(false);
				main.add(map[ii][i]);
			}
		}
	}
	
	private void setupComponents() {
		main = new JPanel(new GridLayout(10, 10));
		border = new JPanel(new BorderLayout());
		content = new JTextArea();
		content.setEditable(false);
	}
	
	private void addComponents() {
		for (int ii = 0; ii < 10; ii++) {
			for (int i = 0; i < 10; i++) {
				main.add(map[ii][i]);
			}
		}
		border.add(main, BorderLayout.CENTER);
		content.setFont(new Font("Arial", Font.BOLD, 16));
		content.setText("\r\nInformation about the game will be here\r\n");
		border.add(content, BorderLayout.SOUTH); 
	}
	
	public static void printInfo(String s) {
		content.setText(s);
	}
}
